function gallery(){}

gallery.updateTitle = function(title, idImage){
	$.post(W_AJAX + "gallery/updateTitle.php", {title: title, idImage: idImage}, '', 'json');
}

gallery.deleteImage = function(idImage, name){
	if(confirm("Вы действительно хотите удалить фотографию?")){		
		$.post(W_AJAX + "gallery/deleteImage.php", {name: name}, '', 'json');
		$("#image_" + idImage).remove();
	}
}

gallery.makeMainImage = function(idImage, essence, idEssence){
	if($('#imageCheckBox_' + idImage + ':checked').val() == 'on'){
		$('.imageCheckBox').attr('checked', '');
		$('#imageCheckBox_' + idImage).attr('checked', 'checked');
		$.post(W_AJAX + "gallery/makeImageMain.php", {idImage: idImage, essence: essence, idEssence: idEssence}, '', 'json');			
	}
	else{
		$.post(W_AJAX + "gallery/unmakeImageMain.php", {idImage: idImage, essence: essence, idEssence: idEssence}, '', 'json');				
	}
}